/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-10
 * Time: 22:51
 */
public class Demo1 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread t1 = new Thread(() -> {
            synchronized (object) {
                System.out.println("wiat 之前");
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("wait 之后");
            }
        });

        Thread t2 = new Thread(() -> {
            synchronized (object) {
                System.out.println("notify 之前");
                object.notify();
                System.out.println("notify 之后");
            }
        });
        t1.start();
        t2.start();
    }
}
